package Work4.Slay_the_Maze.Cards;

import Work4.Slay_the_Maze.Cards.Interface.*;
import Work4.Slay_the_Maze.Monsters.*;
import Work4.Slay_the_Maze.Player.*;
import java.util.ArrayList;
import java.util.Scanner;

public class attack extends Cards implements Attack {
	int att=9;
	public int getAtt() {
		return att;
	}

	public void setAtt(int att) {
		this.att = att;
	}

	public attack() {
		super(1,"攻击","攻击牌",25);
	}
	
	public attack(attack other) {
        // 调用父类的构造函数，复制父类属性
        super(other.getCost(), other.getName(), other.getCardtype(),other.getValue());
        // 复制 Defense 类的特定属性
        this.att = other.att;
    }

    // 克隆方法
    @Override
    public Cards clone() {
        return new attack(this);  // 使用拷贝构造函数
    }
	
	@Override
	public void PrintInfo() {
		System.out.println("费用:"+getCost()+"   "+getName()+"  效果:造成9点伤害"+"   "+getCardtype());
	}
	
	@Override
	public void Attack(Player user,Monster target) {
		int tempatt=(int)(att*user.getAttrate())+user.getPower();
		target.setHP(target.getHP()-tempatt);
		System.out.println("造成"+tempatt+"伤害");
	}
	
	public void Useit(Player player,ArrayList<Monster> monsters) {
		System.out.println("选择目标:");
		for(int i=monsters.size()-1;i>=0;i--) {
			System.out.printf("["+(i+1)+"]");
			monsters.get(i).PrintInfo();
		}
		Scanner sc=new Scanner(System.in);
		int index;
		boolean temp=true;
		do {
			index=sc.nextInt();
			temp=true;
			if(index!=1&&index!=2) {
				System.out.println("选择目标:");
				temp=false;
				
			}
		}while(!temp);
		Attack(player,monsters.get(index-1));
	}
}
